package model;

import java.io.Serializable;

import javax.persistence.*;

import dto.CitizenDTO;

import java.util.Date;
import java.util.List;


/**
 * The persistent class for the citizen database table.
 * 
 */
@Entity
@NamedQuery(name="Citizen.findAll", query="SELECT c FROM Citizen c")
public class Citizen implements Serializable {
	private static final long serialVersionUID = 1L;

	public static final Citizen FIND_ALL = Citizen.findAll() ;

	@Id
	private int idCitizen;

	@Temporal(TemporalType.DATE)
	private Date dateBirth;

	private String email;

	private String name;

	private String password;

	private String surname;
	
	
	
	//bi-directional one-to-one association to Vote
	@OneToOne
	//@JoinColumn(name="idCitizen", referencedColumnName="idCitizen")
	@PrimaryKeyJoinColumn
	private Vote vote;
	public Citizen(){
		
	}

	public Citizen(CitizenDTO citizen) {
		this.name = citizen.getEmail();
		this.surname = citizen.getSurname();
		this.email = citizen.getEmail();
		this.password = citizen.getPassword();
		this.dateBirth = citizen.getDateBirth();
	}

	public int getIdCitizen() {
		return this.idCitizen;
	}

	public void setIdCitizen(int idCitizen) {
		this.idCitizen = idCitizen;
	}

	public Date getDateBirth() {
		return this.dateBirth;
	}

	public void setDateBirth(Date dateBirth) {
		this.dateBirth = dateBirth;
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getSurname() {
		return this.surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}


	public Vote getVote() {
		return this.vote;
	}

	public void setVote(Vote vote) {
		this.vote = vote;
	}

	public static Citizen findAll() {
		return null;
		
	}

}